import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import Components from "unplugin-vue-components/vite";
import { VantResolver } from "unplugin-vue-components/resolvers";
import path from "path";

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    Components({
      resolvers: [VantResolver()], // 自动按需引入 Vant 组件
    }),
  ],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"), // 确保 @ 别名指向 src 目录
    },
  },
  server: {
    host: "0.0.0.0", // 允许所有 IP 访问
    port: 5173, // 指定端口号（可选）
  },
});
